package com.wecloud.core.constant;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.wecloud.core.user.WeUser;

public class WeContext {
	private WeUser user;//用户
	private String transactionId;//请求交易
	private Map response = new HashMap();
	private ConcurrentHashMap data = new ConcurrentHashMap();
	private HttpServletRequest request;
	private HttpServletResponse resp;
	public HttpServletResponse getResp() {
		return resp;
	}

	public void setResp(HttpServletResponse resp) {
		this.resp = resp;
	}

	public Map getData() {
		return data;
	}
	public Object getData(String key) {
		return data.get(key);
	}

	public void setData(String paramString,Object data) {
		this.data.put(paramString, data);
	}
	public void setData(Map data) {
		this.data.putAll(data);
	}

	public String getString(String key){
		return data.get(key) == null ? "" :  data.get(key).toString();
	}
	public int getInteger(String key){
		return data.get(key) == null ? 0 :  Integer.valueOf(data.get(key).toString());
	}
	
	public HttpServletRequest getRequest() {
		return request;
	}
	public void setRequest(HttpServletRequest request) {
		this.request = request;
	}
	public Map getResponse() {
		return response;
	}
	public void setResponse(Map response) {
		this.response = response;
	}
	public void setResponse(String key,Object Value) {
		this.response.put(key, Value);
	}
	public WeUser getUser() {
		return user;
	}
	public void setUser(WeUser user) {
		this.user = user;
	}
	public String getTransactionId() {
		return transactionId;
	}
	public void setTransactionId(String transactionId) {
		this.transactionId = transactionId;
	}
	
}
